package com.linkhub.oms.dao.mpservice.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkhub.oms.dao.mapper.CompanyV2EntityMapper;
import com.linkhub.oms.dao.mpservice.ICompanyV2Service;
import com.linkhub.oms.entity.CompanyV2Entity;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @ClassName CompanyV2ServiceImpl
 * @Description: com.linkhub.oms.dao.mpservice.impl
 * @Author: Jaycle
 * @CreateDate: 2025/5/26 18:04
 * @Version: 1.0
 */
@Service
public class CompanyV2ServiceImpl extends ServiceImpl<CompanyV2EntityMapper, CompanyV2Entity> implements ICompanyV2Service {
    @Override
    public boolean exist( String userId, Long id, String companyName ) {
        return lambdaQuery()
                .eq(CompanyV2Entity::getUserId, userId)
                .ne(Objects.nonNull(id), CompanyV2Entity::getId, id)
                .eq(CompanyV2Entity::getCompanyName, companyName)
                .exists();
    }
}
